<%--
  Created by IntelliJ IDEA.
  User: dj
  Date: 2018-09-17
  Time: 16:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <link rel="stylesheet" href="/static/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/login-1.css">
    <link rel="stylesheet" type="text/css" href="/static/css/pagemain.css">
    <link rel="stylesheet" type="text/css" href="/static/css/index.css">
    <link rel="stylesheet" href="/static/js/layui/css/layui.css"/>
    <link rel="stylesheet" href="/static/js/bootstrap-3.3.5/assets/bootstrap-table/src/bootstrap-table.css"/>
    <link rel="stylesheet" href="/static/js/bootstrap-3.3.5/assets/examples.css"/>
    <link rel="stylesheet" href="/static/js/bootstrap-3.3.5/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="/static/css/my-stlye.css"/>
    <link rel="stylesheet" href="/static/js/plugins/layer/skin/layer.css"/>
    <link rel="stylesheet" type="text/css" href="/static/js/jquery-easyui-1.5/themes/default/easyui.css">
    <script type="text/javascript" src="/static/js/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="/static/js/bootstrap-3.3.5/bootstrap.min.js"></script>
    <script type="text/javascript" src="/static/js/jquery-easyui-1.5/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/static/js/easyuiPager.js"></script>
    <script type="text/javascript" src="/static/js/jquery-easyui-1.5/datagrid-filter.js"></script>
    <script type="text/javascript" src="/static/js/plugins/layer/layer.js"></script>
    <script type="text/javascript" src="/static/js/my97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="/static/js/dlchart.js"></script>
    <script type="text/javascript" src="/static/js/echarts.min.js"></script>
    <script type="text/javascript" src="/static/js/common.js"></script>
    <script type="text/javascript" src="/static/js/my97DatePicker/WdatePicker.js"></script>
    <title>科室预警列表</title>

    <script type="text/javascript">
        $(function () {
            var height = findDimensions_height();
            $("#t_datagrid").height(70);
            $("#l_datagrid").height(200);
            $("#yyinfo").height(200);
            $("#zlczinfo").height(200);
            $("#jyinfo").height(200);

            initt_datagrid();
            initl_datagrid();
            inityyinfoGrid();
            initzlczinfoGrid();
			initjyinfoGrid();
            search();
        })
        function search() {
            var myurl = new objURL();
            var kscode = myurl.get('kscode');
            var Sdate = myurl.get('Sdate');
            var Edate = myurl.get('Edate');
            $.getJSON("/commapiV2", {
                p_dm: "Y_ysjg_GetKsYjInfo",
                Sdate: Sdate,
                Edate: Edate,
                KsCode: kscode,
                List: ''
            }, function (data) {
                if (data.success) {
                    var griddata = {};
                    griddata.rows = data.Table;
                    griddata.total = data.totalcount;
                    $('#t_datagrid').datagrid('loadData', griddata);
                    $("#t_datagrid").datagrid("selectRow", 0);
                }
            }, true);
        }

        function Bandl_datagrid(CellName) {
            var myurl = new objURL();
            var kscode = myurl.get('kscode');
            var Sdate = myurl.get('Sdate');
            var Edate = myurl.get('Edate');
            $.getJSON("/commapiV2", {
                p_dm: "Y_ysjg_GetKsYjInfo",
                Sdate: Sdate,
                Edate: Edate,
                KsCode: kscode,
                List: CellName
            }, function (data) {
                if (data.success) {
                    var griddata = {};
                    griddata.rows = data.Table;
                    griddata.total = data.totalcount;
                    $('#l_datagrid').datagrid('loadData', griddata);
                    $("#l_datagrid").datagrid("selectRow", 0);
                }
            }, true);
        }
        function initt_datagrid() {
            $("#t_datagrid").datagrid({
                fit: false, //自动适屏功能
                rownumbers: true,//显示行号
                singleSelect: true,//只显示一行 
                remoteSort: false,
                clientPaging: false,
                fitColumns: true,
                sortable: true, //启用排序列
                collapsible: true,
                idField: 'kscode',
                columns: [
                    [
                        {field: 'kscode', title: '科室代码', hidden: true},
                        {field: 'ksname', title: '科室名称', width: '150px', align: 'center'},
                        {field: 'zkrs', title: '在科人数', width: '90px', align: 'center'},
                        {field: 'F1', title: '体温异常<br />人数', width: '90px', align: 'center'},
                        {field: 'F2', title: '病原学<br />送检人数', width: '90px', align: 'center'},
                        {field: 'F3', title: '病原学送检<br />阳性人数', width: '90px', align: 'center'},
                        {field: 'F4', title: '使用抗菌<br />药物人数', width: '90px', align: 'center'},
                        {field: 'F5', title: '血常规中性粒细胞<br />百分比异常人数', width: '90px', align: 'center'},
                        {field: 'F6', title: '血常规白细胞<br />异常人数', width: '90px', align: 'center'},
                        {field: 'F7', title: 'C反应蛋白<br />异常人数', width: '90px', align: 'center'},
                        {field: 'F8', title: '便常规镜检白细<br />胞异常人数', width: '90px', align: 'center'},
                        {field: 'F9', title: '胸腹水常规白细<br />胞异常人数', width: '90px', align: 'center'},
                        {field: 'F10', title: '红细胞沉降率<br />异常人数', width: '90px', align: 'center'},
                        {field: 'F11', title: '降钙素原异常<br />异常人数', width: '90px', align: 'center'},
                        {field: 'F12', title: '尿检白细胞异<br />常人数', width: '90px', align: 'center'},
                    ]
                ], onClickCell: function (index, field, value) {
                    var row = $('#t_datagrid').datagrid('getSelected');
                    var cellName = "";
                    switch (field) {
                        case "F1":
                            cellName = "体温异常";
                            break;
                        case "F2":
                            cellName = "病原学送检";
                            break;
                        case "F3":
                            cellName = "病原学送检阳性";
                            break;
                        case "F4":
                            cellName = "使用抗菌药物";
                            break;
                        case "F5":
                            cellName = "血常规中性粒细胞百分比异常";
                            break;
                        case "F6":
                            cellName = "血常规白细胞异常";
                            break;
                        case "F7":
                            cellName = "C反应蛋白异常";
                            break;
                        case "F8":
                            cellName = "便常规镜检白细胞异常";
                            break;
                        case "F9":
                            cellName = "胸腹水常规白细胞异常";
                            break;
                        case "F10":
                            cellName = "红细胞沉降率异常";
                            break;
                        case "F11":
                            cellName = "降钙素原异常";
                            break;
                        case "F12":
                            cellName = "尿检白细胞异常";
                            break;
                        default:
                            cellName = "体温异常";
                    }
                    Bandl_datagrid(cellName);
                }
            });
        }
        function initl_datagrid() {
            $('#l_datagrid').datagrid({
                fit: false, //自动适屏功能
                rownumbers: true,//显示行号
                singleSelect: true,//只显示一行 
                remoteSort: false,
                clientPaging: false,
                fitColumns: true,
                sortable: true, //启用排序列
                collapsible: true,
                idField: 'blh',
                columns: [
                    [
                        {field: 'blh', title: '病例号', hidden: true},
                        {
                            field: 'zyh', title: '住院号', width: '90px', align: 'center',
                            formatter: function (value, row, index) {
                                return '<a style="color:blue" href="/HzinfoDisplay/Hzinfo_sxt?blh=' + row.blh + '&zyh=' + row.zyh + '" target="view_frame">' + row.zyh + '</a>';
                            }
                        },
                        {field: 'zycs', title: '住院次数', width: '55px', align: 'center'},
                        {field: 'hzxm', title: '患者姓名', width: '90px', align: 'center'},
                        {field: 'xb', title: '性别', width: '45px', align: 'center'},
                        {field: 'hznl', title: '年龄', width: '45px', align: 'center'},
                        {field: 'ryrq', title: '入院日期', width: '130px', align: 'center'},
                        {field: 'zgys', title: '主管医生', width: '120px', align: 'center'},
                        {field: 'list', title: '异常原因', width: '220px', align: 'center'} 
                    ]
                ], onClickCell: function (index, field, value) {
                    var row = $('#l_datagrid').datagrid('getSelected');
                    var myurl = new objURL();
                    var Sdate = myurl.get('Sdate');
                    var Edate = myurl.get('Edate');
                    //体温单
                    $.getJSON("/commapiV2", {
                        p_dm: "Thz_tw_get",
                        blh: row.blh,
                        Sdate: '2018-03-05',
                        Edate: '2018-03-20'
                    }, function (data) {
                        if (data.success) {
                            var X = new Array();
                            var Y = new Array();
                            $.each(data.Table, function (i, obj) {
                                X.push(obj.clsj);
                                Y.push(obj.tw);
                            })
                            SetData(X, Y);
                        }
                    }, true);
                    //用药信息
                    $.getJSON("/commapiV2", {
                        p_dm: "THZ_YYINFO_GetByblh",
                        blh: row.blh,
                    }, function (data) {
                        if (data.success) {
                            var griddata = {};
                            griddata.rows = data.Table;
                            griddata.total = data.totalcount;
                            $('#yyinfo').datagrid('loadData', griddata);
                        }
                    }, true);
                    //操作信息
                    $.getJSON("/commapiV2", {
                        p_dm: "Thz_zlcz_get",
                        blh: row.blh,
                    }, function (data) {
                        if (data.success) {
                            var griddata = {};
                            griddata.rows = data.Table;
                            griddata.total = data.totalcount;
                            $('#zlczinfo').datagrid('loadData', griddata);
                        }
                    }, true);
					//送检信息
					$.getJSON("/commapiV2", {
                        p_dm: "Thz_byxjg_getByzyh",
                        zyh: row.zyh
                    }, function (data) {
                        if (data.success) {
                            var griddata = {};
                            griddata.rows = data.Table;
                            griddata.total = data.totalcount;
                            $('#jyinfo').datagrid('loadData', griddata);
                        }
                    }, true);
					//血常规
					$.getJSON("/commapiV2", {
                        p_dm: "THZ_Grbjw_Get",
                        blh: row.blh,
                        jyxm: "血常规白细胞",
                    }, function (data) {
                        if (data.success) {
                            var X = new Array();
                            var Y = new Array();
                            $.each(data.Table, function (i, obj) {
                                X.push(obj.cysj);
                                Y.push(obj.jyjg);
                            })
                            SetxcgData(X, Y);
                        }
                    }, true);
                }
            });
        }
        function inityyinfoGrid() {
            $('#yyinfo').datagrid({
                fit: false, //自动适屏功能
                rownumbers: true,//显示行号
                singleSelect: true,//只显示一行
                remoteSort: false,
                clientPaging: false,
                fitColumns: true,
                sortable: true, //启用排序列
                collapsible: true,
                idField: 'blh',
                columns: [
                    [
                        {field: 'blh', title: '病例号', hidden: true},
                        {field: 'zyh', title: '住院号', hidden: true},
                        {field: 'zycs', title: '住院次数', hidden: true},
                        {field: 'kjywmc', title: '用药信息', width: '180px', align: 'center',},
                        {field: 'kssj', title: '开始时间', width: '130px', align: 'center'},
                        {field: 'jssj', title: '结束时间', width: '130px', align: 'center'},
                        {field: 'yymd', title: '用药目的', width: '60px', align: 'center'},
                        {field: 'yytj', title: '用药途径', width: '200px', align: 'center'},
                        {field: 'kjywjb', title: '抗菌药物级别', width: '120px', align: 'center'},
                        {field: 'yzbh', title: '医嘱编号', hidden: true}
                    ]
                ]
            });
        }
        function initzlczinfoGrid() {
            $('#zlczinfo').datagrid({
                fit: false, //自动适屏功能
                rownumbers: true,//显示行号
                singleSelect: true,//只显示一行 
                remoteSort: false,
                clientPaging: false,
                fitColumns: true,
                sortable: true, //启用排序列
                collapsible: true,
                idField: 'yzid',
                columns: [
                    [
                        {field: 'blh', title: '病例号', hidden: true},
                        {field: 'zyh', title: '住院号', width: '80px', align: 'center'},
                        {field: 'zycs', title: '住院次数', hidden: true},
                        {field: 'yzid', title: '医嘱编号', hidden: true},
                        {field: 'qxmc', title: '器械名称', width: '180px', align: 'center'},
                        {field: 'qxkssj', title: '器械使用开始时间', width: '130px', align: 'center'},
                        {field: 'qxjssj', title: '器械使用结束时间', width: '130px', align: 'center'},
                        {field: 'yznr', title: '医嘱内容', width: '180px', align: 'center'}
                    ]
                ]
            });
        }
		function initjyinfoGrid() {
            $('#jyinfo').datagrid({
                fit: false, //自动适屏功能
                rownumbers: true,//显示行号
                singleSelect: true,//只显示一行 
                remoteSort: false,
                clientPaging: false,
                fitColumns: true,
                sortable: true, //启用排序列
                collapsible: true,
                idField: 'yzid', 
                columns: [
                    [
                        {field: 'blh', title: '病例号', hidden: true},
                        {field: 'jyid', title: '检验ID', hidden: true},
                        {field: 'zyh', title: '住院号', width: '80px', align: 'center'},
                        {field: 'zycs', title: '住院次数', width: '80px', align: 'center'},
                        {field: 'jgid', title: '结果ID', hidden: true},
                        {field: 'bbmc', title: '标本名称', width: '130px', align: 'center'},
                        {field: 'cysj', title: '采样时间', width: '130px', align: 'center'},
                        {field: 'bytjg', title: '检验结果', width: '180px', align: 'center'},
                        {field: 'bgsj', title: '报告时间', width: '180px', align: 'center'},
                        {field: 'sjks', title: '送检科室', width: '180px', align: 'center'},
                    ]
                ]
            }).datagrid('clientPaging');
        }
        function SetData(Xdata, Ydata) {
            var myChart = echarts.init(document.getElementById("dataTwd"));
            option = {
                xAxis: {
                    type: 'category',
                    data: Xdata
                },
                yAxis: {
                    type: 'value',
                    scale: true,
                    max: 40,
                    min: 35
                },
                series: [{
                    data: Ydata,
                    type: 'line',
                    markLine: {
                        data: [
                            {yAxis: '37.5', name: '警戒值'}
                        ]
                    }
                }]
            };
            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);
        }
		function SetxcgData(Xdata, Ydata) {
            var myChart = echarts.init(document.getElementById("dataxcgbxb"));
            option = {
                xAxis: {
                    type: 'category',
                    data: Xdata
                },
                yAxis: {
                    type: 'value',
                    scale: true
                },
                series: [{
                    data: Ydata,
                    type: 'line',
                    markLine: {
                        data: [
                            {yAxis: '10', name: '警戒值'}
                        ]
                    }
                }]
            };
            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);
        }
    </script>
</head>
<body>
<div id="item2" class="man-c-2" style="padding: 0px; width: 100%; margin-top: 10px;">
    <div style="overflow: hidden;">
        <table id="t_datagrid" class="datagrid" style="width: 100%;"></table>
    </div>
    <div id="item5" class="man-c-2">
        <div style="margin:0 5px; overflow: scroll; width:100%">
            <div class="group-rate col-md-3" style="width: 100%;">
                <!--患者信息 -->
                <div class=" mokuai" style="width: 100%; heght:200px;margin-top:10px;">
                    <div class="zhibiao-top back-zb">
                        <b class="back-b">患者信息</b>
                    </div>
                    <div class="datagrid" id="l_datagrid" style="height:200px;margin-top: 10px;"></div>
                </div>
                <!--体温单 -->
                <div class="mokuai" style="width: 100%; heght:250px;margin-top:10px;">
                    <div class="zhibiao-top back-zb">
                        <b class="back-b">体温信息</b>
                    </div>
                    <div class="zhibiao2 table-div" id="dataTwd" style="height:250px; width:100%;"></div>
                </div>
				 <!--血常规 -->
                <div class="mokuai" style="width: 100%; heght:200px ;margin-top: 10px;">
                    <div class="zhibiao-top back-zb">
                        <b class="back-b">血常规</b>
                    </div>
                    <div class="zhibiao2 table-div" id="dataxcgbxb" style="height:250px; width:100%;"></div> 
                </div>
                <!--用药信息 -->
                <div class="mokuai" style="width: 100%; heght:200px ;margin-top: 10px;">
                    <div class="zhibiao-top back-zb">
                        <b class="back-b">用药信息</b>
                    </div>
                    <table id="yyinfo" class="datagrid" style="width:100%"></table>
                </div>
                <!--操作信息 -->
                <div class="mokuai" style="width: 100%; heght:200px ;margin-top: 10px;">
                    <div class="zhibiao-top back-zb">
                        <b class="back-b">操作信息</b>
                    </div>
                    <table id="zlczinfo" class="datagrid" style="width:100%"></table>
                </div>
                <!--检验信息 -->
                <div class="mokuai" style="width: 100%; heght:200px ;margin-top: 10px;">
                    <div class="zhibiao-top back-zb">
                        <b class="back-b">检验信息</b>
                    </div>
                    <table id="jyinfo" class="datagrid" style="width:100%"></table>
                </div>
               
            </div>
        </div>
    </div>
</div>
</body>
</html>
